<template>
  <div :style="{'position':position ? 'absolute' :'static','top':top + 'px','left':left + 'px',display: 'flex'}">
    <div v-if="text" style="margin-right: 8px; color: #0e90c4">{{ text }}</div>
    <div :class="{ blinking: !isBlinking, 'not-blinking': isBlinking }" :style="[customStyle]"></div>
  </div>
</template>

<script setup>
const props = defineProps({
  text: {
    type: String,
  },
  isBlinking: {
    type: [Number,Boolean]
  },
  position:{
    type:Boolean,
    default:false
  },
  top:{
    type:[Number,String],
    default:0
  },
  left:{
    type:[Number,String],
    default:0
  },
  customStyle:{
    type:Object,
    default(){
      return {}
    }
  }
});
</script>

<style scoped>
.blinkingLight-page {
  display: flex;
  align-items: center;
  justify-content: center;
}
.blinking {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #4caf50;
  animation: blink-animation 1s infinite;
}

.not-blinking {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #c0c0c0;
}

@keyframes blink-animation {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}
</style>
